package com.qf.mapper;

import com.qf.entity.Profile;
import com.qf.utils.DBUtil;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.List;

public class ProfileDaoImpl implements  ProfileDao {
    private QueryRunner queryRunner = new QueryRunner(DBUtil.getDateSource());

    @Override
    public List<Profile> getAll() {
        String sql = "select * from profile";
        List<Profile> list = null;
        try {
            list = queryRunner.query(sql, new BeanListHandler<Profile>(Profile.class));
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return list;
    }
}
